
# coding=utf-8

class permutation:
    def __init__(self, n, P):
        self.n = n
        self.P = [x for x in P]
    def print(self):
        print("Permutation:")
        print([i + 1 for i in range(self.n)])
        print([i for i in self.P])
    def multiply(self, it1):
        it2 = permutation(self.n, self.P)
        for i in range(self.n):
            it2.P[i] = self.P[it1.P[i] - 1]
        return it2
    def equal(self, it1):
        if self.n == it1.n and self.P == it1.P:
            return True
        return False
P1 = permutation(3,[3,2,1])
P1.print()
P2 = permutation(3,[2,3,1])
P2.print()
P3 = P1.multiply(P2)
P3.print()
